import request from '@/utils/request'

// 1.发起流程申请
export function startProcess(data) {
  return request({
    url: `/user/process/startProcess`,
    data,
    method: 'post'
  })
}

// 2.查询审批单的详情数据
export function instanceProcess(id) {
  return request({
    url: `/user/process/instance/${id}`
  })
}

// 3.查询申请列表
// export function getApprovalList(data) {
//   return request({
//     url: `/user/process/instance/${data.page}/${data.size}`,
//     method: 'put'
//   })
// }

export function getApprovalList(data) {
  return request({
    url: `/user/process/instance/${data.page}/${data.pageSize}`,
    method: 'put',
    data
  })
}
// 4.查询审批单的详情数据
export function getApprovalDetail(id) {
  return request({
    url: `/user/process/instance/${id}`
  })
}

// 5.查询审批单审批明细
export function getApprovalTasks(id) {
  return request({
    url: `/user/process/instance/tasks/${id}`
  })
}

// 7.设置流程的挂起与激活状态
export function suspend(params) {
  return request({
    url: `/user/process/suspend/${params.processKey}`,
    params
  })
}

// 8.查询所有的流程定义
export function getFlowList(params) {
  return request({
    url: '/user/process/definition',
    params
  })
}

// 9.提交审核
export function commitApproval(data) {
  return request({
    url: '/user/process/instance/commit',
    method: 'put',
    data
  })
}
